<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>重庆企业医院协会 会员中心</title>
    <include file="public@head_base"/>
    <style>
        .status-div {
            padding: 10px;
            width: 320px;
            margin: auto;
            text-align: center;
            margin-top: 120px;
        }

        .status-div img {
            width: 180px;
        }

        .status-div p {
            margin-top: 24px;
            font-size: 16px;
            color: #0055aa;
            text-align: center;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">会员中心</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{:cmf_get_image_url($user.avatar)}" class="layui-nav-img">
                    {$user.user_nickname}
                </a>
                <!--<dl class="layui-nav-child">-->
                    <!--<dd><a href="">基本资料</a></dd>-->
                    <!--<dd><a href="">安全设置</a></dd>-->
                <!--</dl>-->
            </li>
            <li class="layui-nav-item"><a href="{:cmf_url('user/index/logout')}">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="nav">
                <li class="layui-nav-item"><a href="{:cmf_url('user/index/index')}">主页</a></li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">学术会议</a>
                    <dl class="layui-nav-child">
                        <dd class="layui-this"><a href="{:cmf_url('user/meet/index')}">会议列表</a></dd>
                        <dd class=""><a href="{:cmf_url('user/meet/log')}">报名记录</a></dd>


                        <dd><a href="{:cmf_url('user/member/order')}">订单记录</a></dd>

                    </dl>
                </li>
                <li class="layui-nav-item"><a href="{:cmf_url('user/tougao/index')}">论文投稿</a></li>
                <li class="layui-nav-item"><a href="{:cmf_url('user/member/pay')}">会员缴费</a></li>

            </ul>
        </div>
    </div>

    <div class="layui-body" style="background: #f0f0f0;">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;background: #ffffff;box-shadow: #e0e0e0 2px 2px 2px;">

            <blockquote class="layui-elem-quote">会议列表</blockquote>

            <table class="layui-table">
                <colgroup>
                    <col width="150">
                    <col width="200">
                    <col>
                </colgroup>
                <thead>
                <tr>
                    <th>ID</th>
                    <th>会议</th>
                    <th>个人注册</th>
                    <th>单位注册</th>
                    <th>投稿</th>
                    <th>报名费用</th>
                    <th>报名时间</th>

                    <th>操作</th>

                </tr>
                </thead>
                <tbody id="body">
                <foreach name="list" item="item">
                    <tr>
                        <td>{$item.id}</td>
                        <td><a href="{:cmf_url('meeting/index/show',['id'=>$item.id])}">{$item.name}</a></td>
                        <td>{$item.person_status|status}</td>
                        <td>{$item.unit_status|status}</td>
                        <td>{$item.tg_status|status}</td>
                        <td>
                            <if condition="$user.user_type == 2">
                                <if condition="$item.person_status == 1">
                                    {$item.person_price}
                                    <else/>
                                    ---
                                </if>
                            </if>
                            <if condition="$user.user_type == 3">
                                <if condition="$item.unit_status == 1">
                                    {$item.unit_price}
                                    <else/>
                                    ---
                                </if>
                            </if>
                        </td>

                        <td>{$item.register_end_time|date='Y-m-d',###}</td>
                        <td>
                            <if condition="$item.tg_status == 1">
                                <button onclick="tougao({$item.id})" class="layui-btn layui-btn-small">投稿</button>
                            </if>
                            <if condition="$item.person_status == 1 && $user.user_type == 2">
                                <button onclick="baoming({$item.id})"
                                        class="layui-btn layui-btn-small layui-btn-danger">报名参会
                                </button>
                            </if>
                            <if condition="$item.unit_status == 1 && $user.user_type == 3">
                                <button onclick="baoming({$item.id})"
                                        class="layui-btn layui-btn-small layui-btn-danger">报名参会
                                </button>
                            </if>
                        </td>
                    </tr>
                </foreach>


                </tbody>
            </table>
            <div id="page">

            </div>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © kooki.cn - 技术支持 夼旗科技
    </div>
</div>
<include file="public@scripts"/>
<include file="user/member@pay_popup"/>

<script>
    //JavaScript代码区域
    layui.use(['element', 'laypage','layer'], function () {
        var element = layui.element;
        var laypage = layui.laypage;
        var layer = layui.layer;
        laypage.render({
            elem: 'page', //注意，这里的 test1 是 ID，不用加 # 号
            count: {$count}, //数据总数，从服务端得到
            limit: 10,
            jump: function (obj, first) {
                //obj包含了当前分页的所有参数，比如：
                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                console.log(obj.limit); //得到每页显示的条数
                //首次不执行
                if (!first) {
                    //do something
                    $.get("{:cmf_url('user/meet/index')}?page=" + obj.curr, function (res) {
                        $("#body").html(res)
                    })
                }
            }
        });

    });


    function tougao(id) {
        console.log(id)
        layer.open(
            {
                type: 2,
                content: "{:cmf_url('user/tougao/add')}?mid="+id,
                title: '投稿',
                area:['80%','640px']
            });
    }

    function baoming(id) {
        console.log(id)

        $.post("{:cmf_url('user/meet/join')}?mid="+id,function (res) {
            if(res.code  == 1){
                if(res.data.need_pay == 1){
                    var order_id = res.data.order_id
                    payOrder(order_id)
                }else {
                    layer.msg(res.msg);
                }
            }else {
                layer.msg(res.msg)
            }
        })
    }
</script>
</body>
</html>
